package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.NewDto;
import com.heima.wemedia.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author 嘉德罗斯
 * @date 2021/11/29
 */
@RequestMapping("/api/v1/news")
@RestController
public class NewsController {

    @Autowired
    private NewsService newsService;

    @PostMapping("/list_vo")
    private ResponseResult list(@RequestBody NewDto dto){
        return newsService.list(dto);
    }

    @GetMapping("/one_vo/{id}")
    public ResponseResult find(@PathVariable Integer id){
        return newsService.find(id);
    }

    @PostMapping("/auth_pass")
    public ResponseResult authPass(@RequestBody NewDto dto){
        return newsService.authPass(dto);
    }

    @PostMapping("/auth_fail")
    public ResponseResult authFail(@RequestBody NewDto dto){
        return newsService.authFail(dto);
    }
}
